import requests
from bs4 import BeautifulSoup

def get_video_name_url():
    url_txt = {}
    vido_list = {}
    for page in range(1,9):
        web = requests.get('http://91.91p08.space/video.php?category=rf&page=%s'%(page))
        #web.encoding = 'utf-8'
        web = BeautifulSoup(web.text,'html.parser')
        #print (web.prettify())
        #print (web.select('a[target="blank"]'),len(web.select('a[target="blank"]')))
        web_data = (web.select('.listchannel'))
        #print (web_data)

        #url_info = dict(d)
        #print(url_info,type(url_info))
        for a in (web.select('a[target="blank"]')):
            try :
                c = (a['href'],'%s'%(a['title'][:21]))
                value,key = c
                url_txt[key] = value
                #print(c)
            except KeyError:
                pass
        for vido_time in web_data:
            vido_time = vido_time.get_text(separator='|',strip=True)
            if  int(vido_time.split('|')[2][:2]) >= 10 :
                d = (vido_time.split('|')[0].strip('...'))#.replace('\n',','))#.replace(',,,','|').replace(',                ','|').split('|')[:2])
                #print(d)
                if d in url_txt.keys():
                    url =  (url_txt[d])
                    web = requests.get(url)
                    web = BeautifulSoup(web.text, 'html.parser')
                    #print(web.prettify())
                    mp4 = web.select('source')[0]['src']
                    print(mp4,',',vido_time.split('|')[2],d)









get_video_name_url()